<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
    <title>文件编码</title>
    <link rel="icon" href="">
    <link rel="stylesheet" href="../../css/bootstrap.min.css">
  </head>
  <body>
  	<form class="form-inline">
      <div class="form-group">
        <label>文件</label>
        <div class="input-group file-input">
          <input id="fileInput" type="text" class="form-control" /><label class="input-group-addon btn btn-primary">浏览...</label>
        </div>
      </div>
      <div class="form-group">
        <label>目标文件夹</label>
        <div class="input-group file-input" data-dir="dir">
          <input id="targetDir" type="text" class="form-control" /><label class="input-group-addon btn btn-primary">浏览...</label>
        </div>
      </div>
  		<div class="form-group">
  		    <label></label>
  		    <button id="handleBtn" type="button" class="btn btn-primary">处理</button>
  		</div>
  	</form>

    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../../js/template-web.js"></script>
    <script type="text/javascript" src="../../js/fileinput.js"></script>
    <script type="text/javascript">
        $("#handleBtn").click(function(){
            var file=$("#fileInput").val();
            var targetDir=$("#targetDir").val();
            if(file){
              window.top.app.run(`convmv -f GBK -t UTF-8 -r --nosmart --notest "${file}"`+(targetDir?` "${targetDir}"`:''));
            }
        });
    </script>
  </body>
</html>
